﻿using System;
using Besture.Bll;
using Besture.Common;

using Besture.Common.Helper;

namespace Besture.UI.Admin.Content
{
    public partial class TemplateSet : BasePage
    {
        public string _Path = StringHelper.Query("path");

        /// <summary>
        /// 初始化页面
        /// </summary>
        protected override void InitialLoad()
        {
            //网站设置
            rpWebSet.DataSource = new WebOptionsDac().GetDataTable();
            rpWebSet.DataBind();
            //数据源
            RpDataSource.DataSource = new SqlDac().GetDataTable();
            RpDataSource.DataBind();
            //内容模型
            ddlModel.DataSource = QueryDac.GetTable("SELECT * FROM TBContentModel tm");
            ddlModel.DataValueField = "id";
            ddlModel.DataTextField = "name";
            ddlModel.DataBind();

            txtContent.Text =  IoHelper.ReadFile(_Path);
        }

        /// <summary>
        /// 回发
        /// </summary>
        protected override void PostBackLoad()
        {
        }

        protected void  btnSubmit_Click(object o,EventArgs e)
        {
            IoHelper.OverWriteFile(_Path, txtContent.Text);
        }
    }
}